﻿using System;
using UnityEditor;
using UnityEngine;

public class RectDrawType : BaseDrawType
{
    public override Type type { get { return typeof(Rect); } }
    public override string Draw(string name, string arg)
    {
        Rect value = Rect.zero;
        if (!string.IsNullOrEmpty(arg))
        {
            value = JsonUtility.FromJson<Rect>(arg);
        }
        var result = EditorGUILayout.RectField(name, value).ToString();
        return JsonUtility.ToJson(result);
    }
}